/*
 * File:   stack_using_linked_list_simple_test.c
 * Author: anantha
 *
 * Created on 20 Nov, 2011, 7:50:49 PM
 */

#include <stdio.h>
#include <stdlib.h>
#include "stack_using_linked_list.h"
/*
 * Simple C Test Suite
 */

ListNode* createListNode(int data);

void testCreateListNode() {
    int data=10;
    ListNode* result = createListNode(data);
    if (result==NULL) {
        printf("%%TEST_FAILED%% time=0 testname=testCreateListNode (stack_using_linked_list_simple_test) message=error message sample\n");
    }
}

void deleteStack(ListNode** top);

void testDeleteStack() {
    ListNode* top=NULL;
    push(&top,1);
    push(&top,2);
    push(&top,3);
    deleteStack(&top);
    if (top!=NULL) {
        printf("%%TEST_FAILED%% time=0 testname=testDeleteStack (stack_using_linked_list_simple_test) message=error message sample\n");
    }
}

int length(ListNode** top);

void testLength() {
    ListNode* top=NULL;
      push(&top,1);
    push(&top,2);
    push(&top,3);
    push(&top,4);
    int result = length(&top);
    if (result!=4) {
        printf("%%TEST_FAILED%% time=0 testname=testLength (stack_using_linked_list_simple_test) message=error message sample\n");
    }
}

int pop(ListNode** top);

void testPop() {
    ListNode* top=NULL;
      push(&top,1);
    push(&top,2);
    push(&top,3);
    int result = pop(&top);
    if (result!=3) {
        printf("%%TEST_FAILED%% time=0 testname=testPop (stack_using_linked_list_simple_test) message=error message sample\n");
    }
}

void push(ListNode** top, int data);

void testPush() {
    ListNode* top=NULL;
    int data=2;
    push(&top, data);
    if (top==NULL) {
        printf("%%TEST_FAILED%% time=0 testname=testPush (stack_using_linked_list_simple_test) message=error message sample\n");
    }
}

int main(int argc, char** argv) {
    printf("%%SUITE_STARTING%% stack_using_linked_list_simple_test\n");
    printf("%%SUITE_STARTED%%\n");

    printf("%%TEST_STARTED%%  testCreateListNode (stack_using_linked_list_simple_test)\n");
    testCreateListNode();
    printf("%%TEST_FINISHED%% time=0 testCreateListNode (stack_using_linked_list_simple_test)\n");

    printf("%%TEST_STARTED%%  testDeleteStack (stack_using_linked_list_simple_test)\n");
    testDeleteStack();
    printf("%%TEST_FINISHED%% time=0 testDeleteStack (stack_using_linked_list_simple_test)\n");

    printf("%%TEST_STARTED%%  testLength (stack_using_linked_list_simple_test)\n");
    testLength();
    printf("%%TEST_FINISHED%% time=0 testLength (stack_using_linked_list_simple_test)\n");

    printf("%%TEST_STARTED%%  testPop (stack_using_linked_list_simple_test)\n");
    testPop();
    printf("%%TEST_FINISHED%% time=0 testPop (stack_using_linked_list_simple_test)\n");

    printf("%%TEST_STARTED%%  testPush (stack_using_linked_list_simple_test)\n");
    testPush();
    printf("%%TEST_FINISHED%% time=0 testPush (stack_using_linked_list_simple_test)\n");

    printf("%%SUITE_FINISHED%% time=0\n");

    return (EXIT_SUCCESS);
}
